
use crate::{math::Vector2f, color::Rgba, function::render::rhi:: Rhi};






pub struct Wgpu2dMeshVertexStruct {
    pub position:   Vector2f,
    pub tex_coords: Vector2f,
    pub color:      Rgba,
    pub tex_factory:f32,
}



#[derive(Debug)]
pub struct WebgpuPBRMaterial {
    pub base_color_texture:         wgpu::Texture,
    pub base_color_texture_view:    wgpu::TextureView,
    pub material_uniform_buffer:    wgpu::Buffer,
    pub material_group:             wgpu::BindGroup,
}


impl WebgpuPBRMaterial {
    pub fn get_bind_group_layout(rhi:Rhi) -> wgpu::BindGroupLayout{
        

        
        let pbr_material_layout = rhi.borrow().device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
            entries: &[
                wgpu::BindGroupLayoutEntry {
                    binding: 0,
                    visibility: wgpu::ShaderStages::FRAGMENT,
                    ty: wgpu::BindingType::Buffer {   
                        ty: wgpu::BufferBindingType::Uniform,
                        has_dynamic_offset: false,
                        min_binding_size: None, },
                    count: None,
                },

            wgpu::BindGroupLayoutEntry {
                    binding: 1,
                    visibility: wgpu::ShaderStages::FRAGMENT,
                    ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
                    count: None,
                },
            wgpu::BindGroupLayoutEntry {
                    binding: 2,
                    visibility: wgpu::ShaderStages::FRAGMENT,
                    ty: wgpu::BindingType::Texture {
                        multisampled: false,
                        view_dimension: wgpu::TextureViewDimension::D2Array,
                        sample_type: wgpu::TextureSampleType::Float { filterable: true },
                    },
                    count: None,
                },
            ],
            label: Some("bind base color texture layout"),
        });

        pbr_material_layout


    
    }
    
}

